Repository navigation
Refactor the outputs updater, and let it take notebook paths and flags - #1809
Open
classiqdor wants to merge 11 commits into
Open
classiqdor wants to merge 11 commits into
classiqdor wants to merge 11 commits into
Conversation
- split the scripts into functions, and move helpers into utils/ and patch_notebook/ - validate venv and mode before touching git / pip - fix the venv check, which never failed - fix `>/dev/stdout` truncating logs that are redirected to a file - list the notebooks that failed at the end of the run - fix `update_links.py --force` crashing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t / silence_if - split utils into common / git / python / jupyter helpers - add as_bool, silence_if and time_it, and normalize the env-vars once at the top - drop the `cd` before nbconvert, which already runs the kernel in the notebook's folder - stop if creating the branch fails, rather than updating on top of a wrong base Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- every env-var has a matching argument, which takes precedence - boolean flags accept `--flag`, `--no-flag`, and `--flag=<bool>` - report all the invalid arguments at once, before touching git / pip Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…steps - paths (notebooks / folders, relative to the current folder) take precedence over --folder / --mode - '-' reads the paths from stdin, e.g. `git diff --name-only main | main.sh -` - skip jupyter's .ipynb_checkpoints, non-notebook files, and duplicates - add --[no-]create-branch, --[no-]update-pip, and --[no-]create-pr - pass the notebooks NUL-separated, and git add / restore by pathspec Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
update_links.py now writes notebooks like nbformat does too (unescaped unicode and a trailing newline), so that a links-only update changes only the links Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- replace fake_browser.sh with `BROWSER=true` - drop `update_links.py --force`, and always check the cells of the links - convert --folder / --mode into paths, so that the notebooks are listed by one code path - inline the one-line git wrappers, and rename `commit_by_name` to `commit_files` Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- remove the temporary copy / injected cells on exit, even if interrupted (e.g. by ctrl-c) - don't open a PR if the commit failed - check the python3 kernel up front, together with the other validations - fail on a missing notebook in update_single_notebook.sh Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- errors start with "Error:", and are printed to stderr - the venv and kernel errors say how to fix them - update_single_notebook.sh reports failures with "[!]", and logs the notebook path as it was given Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- paths already cover --folder, relative to the current folder. UPDATER_FOLDER stays, relative to the repo root - --mode, as an argument, takes precedence over UPDATER_FOLDER - the `git diff` example uses --relative, so that it works from any folder Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
checking it before pip made the updater refuse to run in a fresh venv Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The outputs updater (
.internal/update_outputs) is split into functions, takes arguments, and can run on just the notebooks you pass it.Usage (see
main.sh --help)main.sh <notebooks / folders>, or pipe them in:git diff --name-only --relative main | main.sh ---mode,-j,--[no-]links-only,--[no-]create-pr, ...). theUPDATER_*env-vars still work, and the flags take precedence--no-create-branch --no-update-pip --no-create-prupdates the notebooks locally, without git / pipLayout
main.sh(update_notebooks.sh) andupdate_single_notebook.sh- the scripts you runutils/- bash helpers (common / git / jupyter / python)patch_notebook/- the python scripts that edit notebooks (injected_cells.py,update_links.py,notebook_utils.py)Fixes
>/dev/stdouttruncated the logs when redirected to a fileTested with a full run against a dummy remote, a fresh venv and a stub
gh(pull, pip, 2 notebooks, pre-commit, commit, PR), once links-only and once updating all the outputs.🤖 Generated with Claude Code